package com.fitns.user.mapper.baseConfig;

import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.fitns.user.model.baseConfig.TbVehicleWorkInfraction;

import java.util.List;
import javax.annotation.Generated;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.mybatis.dynamic.sql.delete.DeleteDSL;
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.render.RenderingStrategy;
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
import org.mybatis.dynamic.sql.select.SelectDSL;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;

@Mapper
public interface TbVehicleWorkInfractionMapper {
    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="record.id", before=false, resultType=Long.class)
    int insert(InsertStatementProvider<TbVehicleWorkInfraction> insertStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TbVehicleWorkInfractionResult")
    TbVehicleWorkInfraction selectOne(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TbVehicleWorkInfractionResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="plate_num", property="plateNum", jdbcType=JdbcType.VARCHAR),
        @Result(column="organ_id", property="organId", jdbcType=JdbcType.BIGINT),
        @Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
        @Result(column="lgitude", property="lgitude", jdbcType=JdbcType.VARCHAR),
        @Result(column="altitude", property="altitude", jdbcType=JdbcType.VARCHAR),
        @Result(column="warn_type", property="warnType", jdbcType=JdbcType.VARCHAR),
        @Result(column="warn_range", property="warnRange", jdbcType=JdbcType.VARCHAR),
        @Result(column="warn_way", property="warnWay", jdbcType=JdbcType.VARCHAR),
        @Result(column="real_id", property="realId", jdbcType=JdbcType.BIGINT),
        @Result(column="location", property="location", jdbcType=JdbcType.VARCHAR),
        @Result(column="input_time", property="inputTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<TbVehicleWorkInfraction> selectMany(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
        return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
                .from(TbVehicleWorkInfractionDynamicSqlSupport.tbVehicleWorkInfraction);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbVehicleWorkInfractionDynamicSqlSupport.tbVehicleWorkInfraction);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int deleteByPrimaryKey(Long id_) {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbVehicleWorkInfractionDynamicSqlSupport.tbVehicleWorkInfraction)
                .where(TbVehicleWorkInfractionDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insert(TbVehicleWorkInfraction record) {
        return insert(SqlBuilder.insert(record)
                .into(TbVehicleWorkInfractionDynamicSqlSupport.tbVehicleWorkInfraction)
                .map(TbVehicleWorkInfractionDynamicSqlSupport.plateNum).toProperty("plateNum")
                .map(TbVehicleWorkInfractionDynamicSqlSupport.organId).toProperty("organId")
                .map(TbVehicleWorkInfractionDynamicSqlSupport.type).toProperty("type")
                .map(TbVehicleWorkInfractionDynamicSqlSupport.lgitude).toProperty("lgitude")
                .map(TbVehicleWorkInfractionDynamicSqlSupport.altitude).toProperty("altitude")
                .map(TbVehicleWorkInfractionDynamicSqlSupport.warnType).toProperty("warnType")
                .map(TbVehicleWorkInfractionDynamicSqlSupport.warnRange).toProperty("warnRange")
                .map(TbVehicleWorkInfractionDynamicSqlSupport.warnWay).toProperty("warnWay")
                .map(TbVehicleWorkInfractionDynamicSqlSupport.realId).toProperty("realId")
                .map(TbVehicleWorkInfractionDynamicSqlSupport.location).toProperty("location")
                .map(TbVehicleWorkInfractionDynamicSqlSupport.inputTime).toProperty("inputTime")
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insertSelective(TbVehicleWorkInfraction record) {
        return insert(SqlBuilder.insert(record)
                .into(TbVehicleWorkInfractionDynamicSqlSupport.tbVehicleWorkInfraction)
                .map(TbVehicleWorkInfractionDynamicSqlSupport.plateNum).toPropertyWhenPresent("plateNum", record::getPlateNum)
                .map(TbVehicleWorkInfractionDynamicSqlSupport.organId).toPropertyWhenPresent("organId", record::getOrganId)
                .map(TbVehicleWorkInfractionDynamicSqlSupport.type).toPropertyWhenPresent("type", record::getType)
                .map(TbVehicleWorkInfractionDynamicSqlSupport.lgitude).toPropertyWhenPresent("lgitude", record::getLgitude)
                .map(TbVehicleWorkInfractionDynamicSqlSupport.altitude).toPropertyWhenPresent("altitude", record::getAltitude)
                .map(TbVehicleWorkInfractionDynamicSqlSupport.warnType).toPropertyWhenPresent("warnType", record::getWarnType)
                .map(TbVehicleWorkInfractionDynamicSqlSupport.warnRange).toPropertyWhenPresent("warnRange", record::getWarnRange)
                .map(TbVehicleWorkInfractionDynamicSqlSupport.warnWay).toPropertyWhenPresent("warnWay", record::getWarnWay)
                .map(TbVehicleWorkInfractionDynamicSqlSupport.realId).toPropertyWhenPresent("realId", record::getRealId)
                .map(TbVehicleWorkInfractionDynamicSqlSupport.location).toPropertyWhenPresent("location", record::getLocation)
                .map(TbVehicleWorkInfractionDynamicSqlSupport.inputTime).toPropertyWhenPresent("inputTime", record::getInputTime)
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbVehicleWorkInfraction>>> selectByExample() {
        return SelectDSL.selectWithMapper(this::selectMany, TbVehicleWorkInfractionDynamicSqlSupport.id, TbVehicleWorkInfractionDynamicSqlSupport.plateNum, TbVehicleWorkInfractionDynamicSqlSupport.organId, TbVehicleWorkInfractionDynamicSqlSupport.type, TbVehicleWorkInfractionDynamicSqlSupport.lgitude, TbVehicleWorkInfractionDynamicSqlSupport.altitude, TbVehicleWorkInfractionDynamicSqlSupport.warnType, TbVehicleWorkInfractionDynamicSqlSupport.warnRange, TbVehicleWorkInfractionDynamicSqlSupport.warnWay, TbVehicleWorkInfractionDynamicSqlSupport.realId, TbVehicleWorkInfractionDynamicSqlSupport.location, TbVehicleWorkInfractionDynamicSqlSupport.inputTime)
                .from(TbVehicleWorkInfractionDynamicSqlSupport.tbVehicleWorkInfraction);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbVehicleWorkInfraction>>> selectDistinctByExample() {
        return SelectDSL.selectDistinctWithMapper(this::selectMany, TbVehicleWorkInfractionDynamicSqlSupport.id, TbVehicleWorkInfractionDynamicSqlSupport.plateNum, TbVehicleWorkInfractionDynamicSqlSupport.organId, TbVehicleWorkInfractionDynamicSqlSupport.type, TbVehicleWorkInfractionDynamicSqlSupport.lgitude, TbVehicleWorkInfractionDynamicSqlSupport.altitude, TbVehicleWorkInfractionDynamicSqlSupport.warnType, TbVehicleWorkInfractionDynamicSqlSupport.warnRange, TbVehicleWorkInfractionDynamicSqlSupport.warnWay, TbVehicleWorkInfractionDynamicSqlSupport.realId, TbVehicleWorkInfractionDynamicSqlSupport.location, TbVehicleWorkInfractionDynamicSqlSupport.inputTime)
                .from(TbVehicleWorkInfractionDynamicSqlSupport.tbVehicleWorkInfraction);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default TbVehicleWorkInfraction selectByPrimaryKey(Long id_) {
        return SelectDSL.selectWithMapper(this::selectOne, TbVehicleWorkInfractionDynamicSqlSupport.id, TbVehicleWorkInfractionDynamicSqlSupport.plateNum, TbVehicleWorkInfractionDynamicSqlSupport.organId, TbVehicleWorkInfractionDynamicSqlSupport.type, TbVehicleWorkInfractionDynamicSqlSupport.lgitude, TbVehicleWorkInfractionDynamicSqlSupport.altitude, TbVehicleWorkInfractionDynamicSqlSupport.warnType, TbVehicleWorkInfractionDynamicSqlSupport.warnRange, TbVehicleWorkInfractionDynamicSqlSupport.warnWay, TbVehicleWorkInfractionDynamicSqlSupport.realId, TbVehicleWorkInfractionDynamicSqlSupport.location, TbVehicleWorkInfractionDynamicSqlSupport.inputTime)
                .from(TbVehicleWorkInfractionDynamicSqlSupport.tbVehicleWorkInfraction)
                .where(TbVehicleWorkInfractionDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(TbVehicleWorkInfraction record) {
        return UpdateDSL.updateWithMapper(this::update, TbVehicleWorkInfractionDynamicSqlSupport.tbVehicleWorkInfraction)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.plateNum).equalTo(record::getPlateNum)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.type).equalTo(record::getType)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.lgitude).equalTo(record::getLgitude)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.altitude).equalTo(record::getAltitude)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.warnType).equalTo(record::getWarnType)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.warnRange).equalTo(record::getWarnRange)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.warnWay).equalTo(record::getWarnWay)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.realId).equalTo(record::getRealId)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.location).equalTo(record::getLocation)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.inputTime).equalTo(record::getInputTime);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(TbVehicleWorkInfraction record) {
        return UpdateDSL.updateWithMapper(this::update, TbVehicleWorkInfractionDynamicSqlSupport.tbVehicleWorkInfraction)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.plateNum).equalToWhenPresent(record::getPlateNum)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.type).equalToWhenPresent(record::getType)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.lgitude).equalToWhenPresent(record::getLgitude)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.altitude).equalToWhenPresent(record::getAltitude)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.warnType).equalToWhenPresent(record::getWarnType)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.warnRange).equalToWhenPresent(record::getWarnRange)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.warnWay).equalToWhenPresent(record::getWarnWay)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.realId).equalToWhenPresent(record::getRealId)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.location).equalToWhenPresent(record::getLocation)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKey(TbVehicleWorkInfraction record) {
        return UpdateDSL.updateWithMapper(this::update, TbVehicleWorkInfractionDynamicSqlSupport.tbVehicleWorkInfraction)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.plateNum).equalTo(record::getPlateNum)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.type).equalTo(record::getType)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.lgitude).equalTo(record::getLgitude)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.altitude).equalTo(record::getAltitude)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.warnType).equalTo(record::getWarnType)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.warnRange).equalTo(record::getWarnRange)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.warnWay).equalTo(record::getWarnWay)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.realId).equalTo(record::getRealId)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.location).equalTo(record::getLocation)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.inputTime).equalTo(record::getInputTime)
                .where(TbVehicleWorkInfractionDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKeySelective(TbVehicleWorkInfraction record) {
        return UpdateDSL.updateWithMapper(this::update, TbVehicleWorkInfractionDynamicSqlSupport.tbVehicleWorkInfraction)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.plateNum).equalToWhenPresent(record::getPlateNum)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.type).equalToWhenPresent(record::getType)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.lgitude).equalToWhenPresent(record::getLgitude)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.altitude).equalToWhenPresent(record::getAltitude)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.warnType).equalToWhenPresent(record::getWarnType)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.warnRange).equalToWhenPresent(record::getWarnRange)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.warnWay).equalToWhenPresent(record::getWarnWay)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.realId).equalToWhenPresent(record::getRealId)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.location).equalToWhenPresent(record::getLocation)
                .set(TbVehicleWorkInfractionDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime)
                .where(TbVehicleWorkInfractionDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }
}